export const wxLogin = (appid) => {
	// let redirect_uri = encodeURIComponent(url)
	window.location.href =
		// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATUS#wechat_redirect`
		`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}redirect_uri=''&response_type=code&scope=snsapi_userinfo&state=STATUS#wechat_redirect`
}

// 获取url上的参数
export const getUrlParam = (name) => {
	let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	let r = window.location.search.substr(1).match(reg); //匹配目标参数
	if (r != null) return decodeURIComponent(r[2]);
	return null; //返回参数值　
}
